<?php
  include_once 'functions.php';
  require_once 'dbfunc.php';
  init_db();
  init_user();
  if(!isset($current_app)){
  	$current_app="";
  }
  if(!isset($current_page)){
  	$current_page="";
  }
  function match_current_app($str1,$str2){
  	if($str1==$str2){
  		echo "current_app";
  	}
  }
?>
<script>register_ctrlpannel();</script>
<div id='ctrlpannel'>
  <div id='mainpannel'>
    <div id='main_tip' class='<?php match_current_app("home",$current_app);?>'><a href='index.php'>首页</a></div>
    <div id='user_tip'>欢迎您：<?php echo $username?></div>
    <div id='user_op'>
    <ul>
        <li class="app_list_item <?php match_current_app("exchange",$current_app);?>"><a href='loop.php'>物品交换</a></li>
        <li class="app_list_item <?php match_current_app("lib",$current_app);?>"><a href="#">图书馆</a></li>
        <li class="app_list_item <?php match_current_app("praywall",$current_app);?>"><a href="#">祷告墙</a></li>
    <?php if($userid!=-1){?>
        <?php $unread_msg=get_unread_message_count($userid);?>
        <li class="app_list_item <?php match_current_app("message",$current_app);?>">
           <a href='message.php'><img src='./image/email.png'><span class='msg_tip' style='padding-left:20px'>消息(<?php echo $unread_msg;?>)</span></a>
        </li>
    <?php }?>
    </ul>
    </div>
    <?php if($userid==-1){?>
    <div id='text_tip'>
    <marquee scrollAmount=3>欢迎访问金灯台家园！</marquee>
    </div>
    <?php }?>
<div id='user_logon_logout'>
<ul>
    <?php if($userid!=-1){ ?>
<li class="log_menu_item"><a href='logout.php'>退出！</a></li>
    <?php }else{?>
<li class="log_menu_item" id='login_button' class='text_button'><a href='#'>登陆</a></li>
<li class="log_menu_item <?php match_current_app("register", $current_page)?>"><a href='register.php'>没有账户？</a>
<div id='register_tip' class='round-top round-bottom'>
<div class='up_arrow'></div>
<p>开始使用之前请点击这里进行注册</p>
</div>
</li>
</ul>
<div id='quick_login' class='fixedtext round-top no_display round-bottom shadow_bottom'>
<form method="post"><input type="hidden" name="reqType" value="logon">
<table id='quick_login_table'>
	<tr>
		<th colspan=2 id='logontip'></th>
	</tr>
	<tr>
		<td><label for="email">邮箱：</label></td>
		<td><input type="text" id='email' name="email" /></td>
	</tr>
	<tr>
		<td><label for="password">密码：</label></td>
		<td><input type="password" id='password' name="password" /></td>
	</tr>
	<tr>
		<td colspan=2 class='bottom_td'>
		<center><input type="button" id="logon" value="登陆" /></center>
		</td>
	</tr>
</table>
</form>
</div>

<?php  }  ?>

　　</div>
  </div>
</div>